<template>
  <div class="edit">
    <el-form :model="ruleForm"
             :rules="rules"
             ref="ruleForm"
             label-width="100px"
             class="yuyi-ruleForm">
      <el-form-item label="门类名称" prop="name">
        <el-input size="small" v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item label="门类代码" prop="name">
        <el-input size="small" v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item label="门类类型" prop="name">
        <el-input size="small" v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item label="排序号" prop="hasMinMaxForm">
        <avue-input-number v-model="ruleForm.hasMinMaxForm"
                           controls-position
                           :precision="0"
                           :min-rows="minRows"
                           :max-rows="maxRows"></avue-input-number>
      </el-form-item>
      <el-form-item label="可用" prop="name">
        <el-switch v-model="ruleForm.name"></el-switch>
      </el-form-item>
      <el-form-item label="备注" prop="name">
        <el-input size="small" type="textarea" :autosize="autosize" v-model="ruleForm.name"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" size="small">{{'确定修改'}}</el-button>
        <el-button size="small" @click="handleCancel">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'editCategory', // 修改门类
  data () {
    return {
      minRows: 1,
      maxRows: 9999,
      autosize: {
        minRows: 4,
        maxRows: 6
      },
      ruleForm: {
        name: '',
        switch: false,
        radio: '',
        hasMinMaxForm: ''
      },
      rules: {
        name: [
          {
            required: true,
            message: '请输入活动名称',
            trigger: 'blur'
          },
          {
            min: 3,
            max: 5,
            message: '长度在 3 到 5 个字符',
            trigger: 'blur'
          }
        ],
        hasMinMaxForm: [
          {
            required: true,
            message: '请输入活动名称',
            trigger: 'blur'
          }
        ]
      }
    }
  },
  methods: {
    handleCancel () {
      // 关闭弹窗清空内容
      /* Object.keys(this.ruleForm).forEach((key) => {
            this.ruleForm[key] = ''
          }) */
      this.$emit('handleCancel')
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
